<?php

error_reporting(E_ALL);

require_once 'core/init.php';

define('MAIN_ACTION', 'Company');
// Config Initialize
$config = initAppConfig();
Registry::getInstance()->set('config', $config);
// Router

$router = new Router();
Registry::getInstance()->set('router', $router);
//Included Files

Registry::getInstance()->set('includedfiles', array());
//чистим данные в глобальных массивах
//new Request();
// Loader
$loader = new Loader();
Registry::getInstance()->set('load', $loader);

// Database 
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
Registry::getInstance()->set('db', $db);
// Front Controller 
$controller = new Front();

// Hook
$hook = new Hook();
Registry::getInstance()->set('hook', $hook);

// Request
$request = new Request();
Registry::getInstance()->set('request', $request);

// Repsonse
$response = new Response();
Registry::getInstance()->set('response', $response);
//
////// Init user
//$user = new LRuser();
//Registry::getInstance()->set('user', $user);
////PageUnit
$pageUnit = new PageUnit("standart");
Registry::getInstance()->set('pageunit', $pageUnit);
//
////// Feed Observer
//$FeedObserver = new FeedObserver();
//Registry::getInstance()->set('feedobserver', $FeedObserver);
////// Messages Observer
//$MessagesObserver = new MessagesObserver();
//Registry::getInstance()->set('messagesobserver', $MessagesObserver);



$controller->dispatch($router->getAction(@$_GET['rewritequery']));
//render and out

$pageUnit->renderPage();
?>

